1

Pick a city of the world to your liking and retrieve its bounding box. Then plot it: What do you see?
The function you may search is part of the osmdata package. Have a look at the slides.
boothbay <- osmdata::getbb("Boothbay")

plot(boothbay)

# We see two points, which build the extremes of the bounding box.

2

Please choose a couple of building types you are interested in and set them as key and value pairs. You can find a list of building types in the Overpass API documentation. But don’t forget to set the timeout query parameters first using the osmdata::opq() function.
First, you specify the bounding box like before, second, the query parameters, and third, the key and value pairs. Try to use a pipe workflow as it makes it a bit easier.
boothbay <-
  osmdata::getbb("Boothbay") |>  
  osmdata::opq(timeout = 25*100) |> 
  osmdata::add_osm_feature(
    key = "building", 
    value = c("house", "residential", "apartments", "detached", "bungalow")
  )

3

Download the data using the osmadata::osmdata_sf() function and extract only the polygons.
The downloaded data are a list. The polygons are a named list element that you can extract with its name osm_polygons, just like a variable in a data table.
boothbay <-
  osmdata::getbb("Boothbay") |>  
  osmdata::opq(timeout = 25*100) |> 
  osmdata::add_osm_feature(
    key = "building", 
  ) |> 
  osmdata::osmdata_sf()

boothbay <- boothbay$osm_polygons

4

Take some time to browse through the data. Depending on the building type you have chosen, you may find some interesting information. You can also plot the data you have just downloaded.
You may consider converting the data into a tibble using tibble::as_tibble() and maybe a sf::st_as_sf() afterwards for a nicer browsing experience.
library(tmap)

boothbay <-
  boothbay |> 
  tibble::as_tibble() |> 
  sf::st_as_sf()

boothbay
## Simple feature collection with 2232 features and 86 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: -69.69212 ymin: 43.7545 xmax: -69.51428 ymax: 43.94156
## Geodetic CRS:  WGS 84
## # A tibble: 2,232 × 87
##    osm_id    name             `addr:city` `addr:county` `addr:hamlet`
##    <chr>     <chr>            <chr>       <chr>         <chr>        
##  1 234813057 <NA>             <NA>        <NA>          <NA>         
##  2 234813059 <NA>             <NA>        <NA>          <NA>         
##  3 234813061 <NA>             <NA>        <NA>          <NA>         
##  4 234813064 <NA>             <NA>        <NA>          <NA>         
##  5 235324281 Southport Memor… Southport   <NA>          <NA>         
##  6 235324664 Robinson's Wharf Southport   <NA>          <NA>         
##  7 235326155 Southport Gener… Southport   <NA>          <NA>         
##  8 307439615 <NA>             Boothbay    <NA>          <NA>         
##  9 307439616 <NA>             Boothbay    <NA>          <NA>         
## 10 307439617 <NA>             Boothbay    <NA>          <NA>         
## # ℹ 2,222 more rows
## # ℹ 82 more variables: `addr:housenumber` <chr>,
## #   `addr:locality` <chr>, `addr:postcode` <chr>,
## #   `addr:state` <chr>, `addr:street` <chr>, `addr:unit` <chr>,
## #   amenity <chr>, area <chr>, barrier <chr>, beauty <chr>,
## #   brand <chr>, `brand:wikidata` <chr>, building <chr>,
## #   `building:colour` <chr>, `building:levels` <chr>, …
tmap_mode(("view"))
## tmap mode set to interactive viewing
tm_shape(boothbay) +
  tm_polygons()